<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'bq.jsp' starting page</title>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/easyui/1.3.4/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/wu.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/icon.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
	$(function() {
		var msg = $("#msg").val();
			    if(msg!=""){
				$.messager.show({
					title:'消息',
					msg:msg
				});
				$("#msg").val("");
			    }
		var id = $('#b').val();
		$('#bq').datagrid({
			url : '${pageContext.request.contextPath}/note?op=show',
			queryParams : {
				id : id
			},
			columns : [ [ 
			{field : 'id',title : '标题',checkbox:true,}, 
			{field : 'tital',title : '标题',width : 180,}, 
			{field : 'content',title : '内容',width : 180,
			} ] ],
			fitColumns : true,
			autoRowHeight : false,
			striped : true,
			loadMsg : '请等待...',
			pagination : true,
			nowrap : true,
			rownumbers : true,
			fit : true,
			toolbar : [ {
				text:'修改',
				iconCls : 'icon-edit',
				handler : function() {
					var obj = $("#bq").datagrid("getSelected");
					$("#bqw").window({
						width : 600,
						height : 400,
						modal : true,
						title : '修改便签',
						iconCls : 'icon-edit'
					});
					$("#ff").form('load', {
						tital : obj.tital,
						content : obj.content,
						id: obj.id
					});
					
				}
			}, '-', {
				text:'添加',
				iconCls : 'icon-add',
				handler : function() {
					$("#bqtj").window({
						width : 600,
						height : 400,
						modal : true,
						title : '添加便签',
						iconCls : 'icon-add'
					});
				},		
			} ,
			 '-', {
			 	text:'删除',
				iconCls : 'icon-remove',
				handler : function() {
					var obj = $("#bq").datagrid("getSelected");
						var str=confirm("确认删除客户信息?");
						if(str==true){
							location.href='${pageContext.request.contextPath}/note?op=delect&id='+obj.id;
					}
				},
			 } ,
			 '-', {
			 	text:'返回主页',
				iconCls : 'icon-undo',
				handler : function() {
					location.href='${pageContext.request.contextPath}/mydesk.jsp';
					//history.go(-1);
				},
			} ]
			
		});
	});
</script>
</head>

<body>
	<input type="hidden" id="b" value="${sys_user.id }">
	<table id="bq"></table>
	<!-- 添加 -->
	<div id="bqtj" style="text-align: center;line-height: 30px">
		<form action="${pageContext.request.contextPath}/note?op=add" method="post" >
			<div>
				<input name="id" type="hidden" value="${sys_user.id}"> 
				<label>标题:</label> <input class="easyui-validatebox"
					type="text" name="tital"></input>
			</div>
			<div>
				<label >内容:</label>&nbsp; <input
					class="easyui-validatebox" type="text" name="content"></input>
			</div>
			<div>
				<input type="submit" value="提交" />
			</div>
		</form>
	</div>
	
	<div>
	<div id="bqw" style="text-align: center;line-height: 30px">
	<input type="hidden" id="b" value="${sys_user.id }">
		<form id="ff" action="${pageContext.request.contextPath}/note?op=update" method="post">
			<p>请输入标题：<input type="text" name="tital"/></p>
    	    <p>请输入新内容：<input type="text" name="content"/></p>
    	    <input name="id" type="hidden" > 
    	    <div>
				<input type="submit" value="提交" />
			</div>
		</form>
		</div>
	</div>
	<input type="hidden" id="msg" value="${msg }">
</body>
</html>
